<?php if(!defined('IN_APP')) exit('Access Denied');?>
<?php include template('toper','common');?>
<?php include template('header','common');?>
<script type="text/javascript" src="template/default/statics/js/index.js"></script>
<script type="text/javascript" src="template/default/statics/js/jquery.cookie.js"></script>
<!--Banner-->
<div class="banner">
<div class="shade-slider">
<ul class="box">
<?php
	$taglib_misc_focus = new taglib('misc','focus');
	$data = $taglib_misc_focus->lists(array('order'=>'sort ASC'), array('limit'=>'20','cache'=>'084399cac6745350d12ad62046eb9112,3600'));
?><?php if(is_array($data)) foreach($data as $r) { ?><li class="item"><a href="<?php echo $r['url'];?>" <?php if($r[target] == 1) { ?> target="_blank" <?php } ?> ><img src="<?php echo $r['thumb'];?>" width="1200" /></a></li>
<?php } ?>

</ul>
</div>
</div>
<!--Banner end-->

<!--content-->
<div class="container border-bottom border-gray-white clearfix">
<div class="fl index-activity">
<ul class="tab layout border-bottom border-gray-white clearfix goods_lists">
<?php
	$taglib_goods_goods = new taglib('goods','goods');
	$data = $taglib_goods_goods->page(array('statusext'=>'3'), array('limit'=>'5','cache'=>'57f4bf92de4450375b0329a333eb743b,3600'));
?>
<?php if($data['count'] > 0) { ?>
<li class="current">
<span>新品推荐</span>
<b></b>
</li>
<?php } ?>

<?php
	$taglib_goods_goods = new taglib('goods','goods');
	$data = $taglib_goods_goods->page(array('statusext'=>'1'), array('limit'=>'5','cache'=>'be612aa71ab1d0121e9d544141c099da,3600'));
?>
<?php if($data['count'] > 0) { ?>
<li>
<span>促销单品</span>
<b></b>
</li>
<?php } ?>

<?php
	$taglib_goods_goods = new taglib('goods','goods');
	$data = $taglib_goods_goods->page(array('statusext'=>'2'), array('limit'=>'5','cache'=>'a3be7238db747eaaff5a90328f629278,3600'));
?>
<?php if($data['count'] > 0) { ?>
<li>
<span>热卖商品</span>
<b></b>
</li>
<?php } ?>

<?php
	$taglib_goods_goods = new taglib('goods','goods');
	$data = $taglib_goods_goods->page(array('statusext'=>'4'), array('limit'=>'5','cache'=>'85cc3ab24e5b2be461568535dbbd9e72,3600'));
?>
<?php if($data['count'] > 0) { ?>
<li>
<span>爆款推荐</span>
<b></b>
</li>
<?php } ?>

</ul>
<div class="tab-tag clearfix">

<?php
	$taglib_goods_goods = new taglib('goods','goods');
	$data = $taglib_goods_goods->lists(array('statusext'=>'3','order'=>'rand()'), array('limit'=>'5','cache'=>'649231fa5c81ad1f7520f676e9edf64d,3600'));
?>
<?php if(!empty($data)) { ?>
<ul class="tag selected"><?php if(is_array($data)) foreach($data as $r) { ?><li class="index-pic-1">
<div class="img"><a href="<?php echo url('goods/index/detail',array('sku_id'=>$r['sku_id']));?>"><img src="<?php echo thumb($r[thumb]);?>" /></a></div>
<div class="text">
<div class="title text-ellipsis"><a href=""><?php echo $r['sku_name'];?></a></div>
<div class="price">￥<?php echo $r['prom_price']?></div>
</div>
</li>
<?php } ?>
</ul>
<?php } ?>
	


<?php
	$taglib_goods_goods = new taglib('goods','goods');
	$data = $taglib_goods_goods->lists(array('statusext'=>'1','order'=>'rand()'), array('limit'=>'5','cache'=>'14ba3c5b2389e7b48f4a90da66ca7aa2,3600'));
?>
<?php if(!empty($data)) { ?>
<ul class="tag"><?php if(is_array($data)) foreach($data as $r) { ?><li class="index-pic-1">
<div class="img"><a href="<?php echo url('goods/index/detail',array('sku_id'=>$r['sku_id']));?>"><img src="<?php echo thumb($r[thumb]);?>" /></a></div>
<div class="text">
<div class="title text-ellipsis"><a href=""><?php echo $r['sku_name'];?></a></div>
<div class="price">￥<?php echo $r['prom_price'];?></div>
</div>
</li>
<?php } ?>
</ul>
<?php } ?>
		
<?php
	$taglib_goods_goods = new taglib('goods','goods');
	$data = $taglib_goods_goods->lists(array('statusext'=>'2','order'=>'rand()'), array('limit'=>'5','cache'=>'8ce057b308756d557b4cf6feffacffe4,3600'));
?>
<?php if(!empty($data)) { ?>
<ul class="tag"><?php if(is_array($data)) foreach($data as $r) { ?><li class="index-pic-1">
<div class="img"><a href="<?php echo url('goods/index/detail',array('sku_id'=>$r['sku_id']));?>"><img src="<?php echo thumb($r[thumb]);?>" /></a></div>
<div class="text">
<div class="title text-ellipsis"><a href=""><?php echo $r['sku_name'];?></a></div>
<div class="price">￥<?php echo $r['prom_price'];?></div>
</div>
</li>
<?php } ?>
</ul>
<?php } ?>


<?php
	$taglib_goods_goods = new taglib('goods','goods');
	$data = $taglib_goods_goods->lists(array('statusext'=>'4','order'=>'rand()'), array('limit'=>'5','cache'=>'f887d49cfb92b314c0b15eea53c07be6,3600'));
?>
<?php if(!empty($data)) { ?>
<ul class="tag"><?php if(is_array($data)) foreach($data as $r) { ?><li class="index-pic-1">
<div class="img"><a href="<?php echo url('goods/index/detail',array('sku_id'=>$r['sku_id']));?>"><img src="<?php echo thumb($r[thumb]);?>" /></a></div>
<div class="text">
<div class="title text-ellipsis"><a href=""><?php echo $r['sku_name'];?></a></div>
<div class="price">￥<?php echo $r['prom_price'];?></div>
</div>
</li>
<?php } ?>
</ul>
<?php } ?>

</div>
</div>
<div class="fr margin-top notice">
<div class="news-plate">
<div class="title border-bottom border-gray-white">
<div class="border-left border-small border-sub padding-left text-sub">文章资讯 
<em style="float:right;"><a href="<?php echo url('misc/index/article_lists');?>">更多</a></em>
</div>
</div>
<ul class="content margin-small-top">
<?php
	$taglib_misc_article = new taglib('misc','article');
	$data = $taglib_misc_article->lists(array('order'=>'id DESC'), array('limit'=>'5','cache'=>'a7cf5c01262b21149151c8dd122b98b8,3600'));
?><?php if(is_array($data)) foreach($data as $k => $r) { ?><li><em>·</em><a <?php if($k < 2 ) { ?>class="hot"<?php } ?> target="_blank" href="<?php echo url('misc/index/article_detail',array('id'=>$r['id']));?>" title="<?php echo $r['title'];?>"><?php echo $r['title'];?></a></li>
<?php } ?>

</ul>
</div>
<div class="brand-text">
<div class="title padding-bottom padding-top">
<div class="border-left border-small border-sub padding-left text-sub">推荐品牌</div>
</div>
<ul>
<?php
	$taglib_goods_brand = new taglib('goods','brand');
	$data = $taglib_goods_brand->lists(array(), array('limit'=>'4','cache'=>'e770e3e9e18cedf19bc2e26ecb58ad8e,3600'));
?><?php if(is_array($data)) foreach($data as $r) { ?><li><a href="<?php echo url('goods/index/brand_list',array('id'=>$r['id']));?>"><?php echo $r['name'];?></a></li>
<?php } ?>
	
</ul>
</div>
</div>
</div>
<!--猜您喜欢-->
<div class="container padding-big-top">
<div class="layout border border-gray-white item-blue-top pro-border-top-gray">
<ul class="tab p-tab-trigger-wrap">
<li class="ui-switchtab-item current"><a href="javascript:;">猜您喜欢</a></li>
<div class="fr margin-big-right text-lh-30"><span>换一批<b class="margin-left refresh change_goods"></b></span></div>
</ul>

<div class="like">
<ul class="clearfix guess_like">
<?php
	$taglib_goods_goods = new taglib('goods','goods');
	$data = $taglib_goods_goods->lists(array('order'=>'rand()'), array('limit'=>'6','cache'=>'f684f291a41f3a69fb786cfe32e19cbf,3600'));
?><?php if(is_array($data)) foreach($data as $r) { ?><li class="index-pic-1">
<div class="img"><a href="<?php echo url('goods/index/detail',array('sku_id'=>$r['sku_id']));?>"><img src="<?php echo thumb($r[thumb]);?>" /></a></div>
<div class="text">
<div class="title text-ellipsis"><a href=""><?php echo $r['sku_name'];?></a></div>
<div class="price">￥<?php echo $r['prom_price']?></div>
</div>
</li>
<?php } ?>

</ul>
</div>
</div>
</div>
<!--1 Floor-->
<?php
	$taglib_goods_category = new taglib('goods','category');
	$data = $taglib_goods_category->lists(array('order'=>'sort asc','catid'=>'0'), array('limit'=>'20','cache'=>'01ff3df4d279d07e35c50b11248b3307,3600'));
?><?php if(is_array($data)) foreach($data as $k => $r) { ?><?php $catid = $r['id']?>
<div class="floor container padding-big-top clearfix">
<div class="floor-info tab">
<div class="floor-logo"><?php echo $k+1?>F</div>
<h3><?php echo $r['name'];?></h3>
<ul class="fr text-default clearfix">
<?php
	$taglib_goods_category = new taglib('goods','category');
	$data = $taglib_goods_category->lists(array('catid'=>$r[id]), array('limit'=>'20','cache'=>'6cd79ce160d2a48badbaaf839f4695f3,3600'));
?><?php if(is_array($data)) foreach($data as $r) { ?><li><span><?php echo $r['name'];?></span></li>
<?php } ?>

</ul>
</div>
<div class="floor-content tab-tag">
<?php
	$taglib_goods_category = new taglib('goods','category');
	$data = $taglib_goods_category->lists(array('catid'=>$catid), array('limit'=>'20','cache'=>'96f24f4ac92a5f994a785f7f1ad658ea,3600'));
?><?php if(is_array($data)) foreach($data as $r) { ?><?php $cat_id = $r['id']?>
<div class="tag">
<div class="left">
<ul class="clearfix">
<?php
	$taglib_goods_goods = new taglib('goods','goods');
	$data = $taglib_goods_goods->lists(array('catid'=>$r[id]), array('limit'=>'8','cache'=>'39ed0d3a33aba2a1862caa75979e78f7,3600'));
?><?php if(is_array($data)) foreach($data as $r) { ?><li class="index-pic-2">
<div class="img"><a href="<?php echo url('goods/index/detail',array('sku_id'=>$r['sku_id']));?>"><img src="<?php echo thumb($r['thumb'],215,215);?>" /></a></div>
<div class="text">
<div class="title"><a href="<?php echo url('goods/index/detail',array('sku_id'=>$r['sku_id']));?>"><?php echo $r['sku_name'];?></a></div>
<div class="price">￥<?php echo $r['prom_price']?></div>
</div>
</li>
<?php } ?>

</ul>
</div>
<div class="right">
<div class="top-text">TOP热销榜</div>
<ul class="top-con">
<?php
	$taglib_goods_goods = new taglib('goods','goods');
	$data = $taglib_goods_goods->lists(array('catid'=>$cat_id,'order'=>'sales desc'), array('limit'=>'10','cache'=>'e2cc156067f8030f724fb63de978ebd2,3600'));
?><?php if(is_array($data)) foreach($data as $k => $r) { ?><li <?php if($k < 1) { ?>class="hover"<?php } ?>>
<div class="no-num"><span <?php if($k < 3) { ?>class="text-mix"<?php } ?>>NO.<?php if($k < 9) { ?>0<?php } ?><?php echo $k+1?></span></div>
<div class="img"><a href="<?php echo url('goods/index/detail',array('sku_id'=>$r['sku_id']));?>"><img src="<?php echo thumb($r['thumb'],215,215);?>" /></a></div>
<div class="text">
<div class="title"><a href="<?php echo url('goods/index/detail',array('sku_id'=>$r['sku_id']));?>"><?php echo $r['sku_name'];?></a></div>
<div class="price"><span>￥<?php echo $r['prom_price']?></span></div>
</div>
</li>
<?php } ?>

</ul>
</div>
</div>
<?php } ?>

</div>
</div>
<?php } ?>

<!--content end-->
<!--遮罩层广告-->
<?php
	$taglib_ads_ads = new taglib('ads','ads');
	$data = $taglib_ads_ads->lists(array('position'=>'3','order'=>'id desc'), array('limit'=>'1','cache'=>'cd4b42306d301854fb5130948c9dcc21,3600'));
?>
<?php if(($data['list'])) { ?>
<div class="mask">
<div class="ads" >
<a href="javascript:;">关闭</a><?php if(is_array($data['list'])) foreach($data['list'] as $r) { ?><?php if(empty($r['content'])) { ?>
<img src="<?php echo $data['defaultpic'];?>" />
<?php } else { ?>
<img src="<?php echo $r['content'];?>" title="<?php echo $r['title'];?>" />
<?php } ?>
<?php } ?>
</div>
</div>
<?php } ?>

<!--底部-->
<div class="hd-toolbar-footer">
<div class="hd-toolbar-tab hd-tbar-tab-top margin-bottom">
<a href="#"><i class="tab-ico"></i></a>
</div>
</div>

<!--floor nav-->
<div class="floor-nav">
<ul>
<?php
	$taglib_goods_category = new taglib('goods','category');
	$data = $taglib_goods_category->lists(array('order'=>'sort asc','catid'=>'0'), array('limit'=>'20','cache'=>'01ff3df4d279d07e35c50b11248b3307,3600'));
?><?php if(is_array($data)) foreach($data as $k => $r) { ?><li>
<a class="name" href="javascript:;"><?php echo $r['name'];?></a>
<a class="f" href="javascript:;"><?php echo $k+1?>F</a>
</li>
<?php } ?>	

</ul>
</div>
<div class="hd-toolbar-footer">
<div class="hd-toolbar-tab hd-tbar-tab-top margin-bottom">
<a href="#"><i class="tab-ico"></i></a>
</div>
</div>
<div class="layout border-top border-gray-white global-footer margin-big-top">
<div class="layout border border-main"></div>
<div class="container hd-service clearfix">
<?php
	$taglib_misc_help = new taglib('misc','help');
	$data = $taglib_misc_help->lists(array('id'=>'0'), array('limit'=>'5','cache'=>'78f2c20390e71701b3623c304bad4fe7,3600'));
?><?php if(is_array($data)) foreach($data as $r) { ?><dl class="fore">
<dt><?php echo $r['title'];?></dt>
<dd>
<?php
	$taglib_misc_help = new taglib('misc','help');
	$data = $taglib_misc_help->lists(array('id'=>$r[id]), array('limit'=>'4','cache'=>'68675f81251b006740f9aba28286056d,3600'));
?><?php if(is_array($data)) foreach($data as $s) { ?><div><a href="<?php echo url('misc/index/help_lists',array('id'=>$s['id']));?>"><?php echo $s['title'];?></a></div>
<?php } ?>

</dd>
</dl>
<?php } ?>

<dl class="fore last">
<dt>&nbsp;<!-- 海盗云商：www.haidao.la --></dt>
<dd>
<span><img src="<?php echo SKIN_PATH;?>statics/images/logo.png" width="158" /></span>
</dd>
</dl>
</div>
<div class="friend-link padding-large-top container">
<dl class="clearfix">
<dt class="fl">友情链接：</dt>
<dd class="fl">
<?php
	$taglib_misc_friendlink = new taglib('misc','friendlink');
	$data = $taglib_misc_friendlink->lists(array(), array('limit'=>'5','cache'=>'c210fa6f2fed689bffd032292d9dac96,3600'));
?><?php if(is_array($data)) foreach($data as $r) { ?><a href="<?php echo $r['url'];?>"><?php echo $r['name'];?></a>
<?php } ?>

</dd>
</dl>
</div>
<div class="container copyright border-top border-gray-white padding-tb clearfix">
<p class="cop-left fl w50 text-lh-small"><?php echo SITE_AUTHORIZE == 0? COPYRIGHT:''?></p>
<div class="cop-right fr text-right w50">
<?php $cache = cache('setting');?>
<p class="text-lh-small"><!-- <a href="">手机版</a> |  -->
<?php if($cache[com_name]) { ?>
<a target="_blank" href="<?php echo $cache['site_url'];?>"><?php echo $cache['com_name'];?></a>  
<?php } ?>
<?php if($cache[icp]) { ?>
|<a target="_blank" href="http://www.miitbeian.gov.cn/"><?php echo $cache['icp'];?></a> 
<?php } ?>
<?php if($cache[site_statice]) { ?>
|<a href=""><?php echo $cache['site_statice'];?></a></p>
<?php } ?>
<p class="text-lh-small">PRC, <em id="time"></em></p>
</div>
</div>
</div>
<?php echo '<hook>[string global_footer]</hook>';echo runhook('global_footer', '');?>
</body>
</html>
<script type="text/javascript">
$(function(){
toggle_ads();
})
function toggle_ads(){
if($.cookie('visits') !== '1'){
var time = new Date();
var nowline =  time.getHours();
var deadline = 24 - nowline;
$.cookie('visits','1',{hoursToLive: deadline });
$(".mask").show();
}
$(".roof").show();
}
$(".mask a").live('click',function(){
$(".mask").hide();
})
$('.change_goods').live('click',function(){
ajax_like('rand()',6);
})
$('.goods_lists').live('click',function(){
ajax_goods();
})
function ajax_like(order,limit){
var url = "<?php echo url('goods/index/ajax_like')?>";
var sku_url = "?m=goods&c=index&a=detail&sku_id=";
$.post(url,{order:order,limit:limit},function(ret){
var html = '';
$.each(ret.lists,function(i,item){
html += '<li class="index-pic-1">'
+		'<div class="img"><a href="'+ sku_url + item.sku_id +'"><img src="'+ item.thumb +'"/></a></div>'
+			'<div class="text">'
+				'<div class="title text-ellipsis"><a href="'+ sku_url + item.sku_id +'">'+ item.sku_name +'</a></div>'
+				'<div class="price">￥'+ item.prom_price +'</div>'
+			'</div>'
+		'</li>';
})
$('.guess_like').html(html);
},'json');
}
function ajax_goods(){
$.ajax({
type: "get",
async: true,
url: "<?php echo url('ajax_goods')?>",
dataType: "json",
success: function(result) {

},
error: function(errorMsg) {
alert("不好意思，大爷，图表请求数据失败啦!");
}
});
}
function current(){ 
var d = new Date(),time=''; 
time += d.getFullYear()+'-';  
time += d.getMonth() < 10 ? '0'+d.getMonth(): d.getMonth() +1+'-'; 
time += d.getDate() < 10 ? '0'+d.getDate() : d.getDate() +' '; 
time += d.getHours() < 10 ? '0'+d.getHours() : d.getHours() +':'; 
time += d.getMinutes() < 10 ? '0'+d.getMinutes() : d.getMinutes() +':'; 
time += d.getSeconds() < 10 ? '0'+d.getSeconds() : d.getSeconds(); 
return time; 
} 
setInterval(function(){$("#time").html(current)},1000);
</script>